// 权限配置 页面的拦截
import router from '@/router'
import whiteList from '@/utils/whiteSpace'
import store from './store'

router.beforeEach((to, from, next) => {
  const token = store.state.commonLogin.token || localStorage.getItem('token')
  if (whiteList.includes(to.path)) next()
  else if (token) {
    next()
  } else next(`/login?redirect=${to.path}`)
})
